package org.jeecg.modules.simulator.factory;

import lombok.Getter;
import lombok.Setter;
import org.jeecg.modules.simulator.factory.train.plan.TimePlanFactory;
import org.jeecg.modules.simulator.factory.train.plan.TimePlanJsonFactory;
import org.jeecg.modules.simulator.factory.train.plan.Train2Parker;
import org.jeecg.modules.simulator.jsonot.NumPeopEnStationApiInfo;
import org.jeecg.modules.simulator.jsonot.ODProbabilityApiInfo;
import org.jeecg.modules.simulator.jsonot.PsgStationDistributionInfo;
import org.jeecg.modules.simulator.jsonot.TrainPsgDistributionApiInfo;
import org.jeecg.modules.simulator.model.line.station.station.Station;
import org.jeecg.modules.simulator.model.line.station.station.TransferStation;
import org.jeecg.modules.simulator.model.person.Person;
import org.jeecg.modules.simulator.model.person.path.PersonPath;
import org.jeecg.modules.simulator.model.train.timeplan.TrainPlanTable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: simulator-b20240918
 * @description:
 * @author: renzhg
 * @create: 2024-10-30 10:29
 **/
public class DataCustomJsonBizFactory {
    @Setter
    String sceneCode;
    TimePlanFactory timePlanFactory = new TimePlanJsonFactory();
    PersonPathFactory personPathFactory = new PersonPathJsonFactory();

    @Setter
    @Getter
    Map<String, TransferStation> transferStationMap = new HashMap<>();
    @Setter
    @Getter
    public Map<String, Station> stationMap = new HashMap<>();
    @Getter
    Map<String, PersonPath> personPathMap = new HashMap<>();//key=路径序号+首站名称
    @Getter
    Map<String, List<TrainPlanTable>> trainPlanTableMapByLine = new HashMap<>();
    @Getter
    List<Train2Parker> tplist = new ArrayList<>();

    //各站人员OD分配概率,key:定义odID
    @Getter
    @Setter
    Map<String, List<ODProbabilityApiInfo>> odProbabilityApiInfoMap = new HashMap<>();


//    乘车人员分布,key:定义odID

    @Getter
    @Setter
    Map<String, TrainPsgDistributionApiInfo> trainPsgDistributionApiInfoMap = new HashMap<>();
    @Getter
    @Setter
    Map<String, Map<String, NumPeopEnStationApiInfo>> numPeopEnStationApiInfoMap = new HashMap<>();
    //    车站人员分布, key:stationId,这个只是路径信息，不是人员信息
    @Getter
    @Setter
    Map<String, List<PsgStationDistributionInfo>> psgStationDistributionInfoMap = new HashMap<>();
    //乘车人员分布
    @Getter
    Map<String, List<Person>> personTrainMap = new HashMap<>();
    @Getter
    //key:列车id，第二个key：阶段路线起始站（可以是换乘站或者开始站）-下车车站名
    Map<String,Map<String,List<Person>>> personTrainMapByLine=new HashMap<>();


    public void loadCustomDataBiz() {
        loadCustomJsonDataTrain();
        loadCustomJsonPersonPath();
    }




    public void loadCustomJsonDataTrain() {
        timePlanFactory.loadTimePlanData();
        trainPlanTableMapByLine = timePlanFactory.getTrainPlanTableByLineMap();

    }



    public void loadCustomJsonPersonPath() {
        personPathFactory.loadData();
        personPathMap = personPathFactory.getPersonPathMap();
    }


}
